package com.ww.springboot.boot.baseTest.基本类型.字符串;

/**
 * 描述：
 *
 * @author 🧑 ‍wanwei
 * @since 2024-12-10 11:26
 */
public class LengthDemo {

    public static void main(String[] args) {
        String s = "";
        //运行时 字符串长度没有上限(有上限-》int最大值 = 2G)  但是编译有上限
        for (int i = 0; i < 100000; i++) {
            try {
                s = s + i;
                System.out.println(i + ":" + s.length());
            } catch (Exception e) {
                System.out.println("异常：" + i);
                System.out.println("异常：" + s.length());
                e.printStackTrace();
            }
        }
        System.out.println("结束");
        System.out.println(s.length());
    }
}
